import Vue from 'vue'
import Router from 'vue-router'
import routerConfig from '@router'

Vue.use(Router)

const router = new Router({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes: routerConfig
})

router.beforeEach((to, from, next) => {
  next()
  console.log('我是全局守卫');
  // if (sessionStorage.getItem("login")) {
  //   if (to.path == '/login') { 
  //     next(false);
  //   } else {
  //     NProgress.start(); //加载条开始
  //     next();      
  //   }
  // } else {
  //   NProgress.start(); //加载条开始
  //   next();   
  // } 
})

router.afterEach(() => {
  // NProgress.done(); //加载条结束
})

export default router